<?php

namespace app\admin\command;

use app\common\util\Tools;
use think\console\Input;
use think\console\Output;
use think\facade\Log;

class VerifierTest extends CommonTest
{

    //再命令窗口中执行“php think interface-VerifierTest”
    protected function configure()
    {
        $this->setName('interface-VerifierTest')
            ->setDescription('接口测试');
    }

    public function execute(Input $input, Output $output)
    {
        parent::execute($input, $output);

        $field = [
            "nickname" => "xxx", "gender" => "1", "mobile" => "13828193199", "email" => NULL, "id_card" => NULL,
            "prefix" => "86", "remark" => ""
        ]; //填入数据库需要存储的表字段

        //Route::any('admin/verifier/getPageList', 'admin/verifier/getVerifierList');                                             // 核销员列表，分页功能
        $data = Tools::curl($this->url . "admin/verifier/getPageList", json_encode(["token" => "$this->token"]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";

        //Route::any('admin/verifier/getDetailsById', 'admin/verifier/getVerifierDetail');                                        // 核销员的详细信息
        $data = Tools::curl($this->url . "admin/verifier/getDetailsById", json_encode(["token" => "$this->token", "id" => 1]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";

        //Route::any('admin/verifier/create', 'admin/verifier/toAddVerifier');                                                    // 添加核销员
        $data = Tools::curl($this->url . "admin/verifier/create", json_encode(array_merge(["token" => "$this->token"], $field)));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";

        //Route::any('admin/verifier/update', 'admin/verifier/toUpdateVerifier');                                                 // 更新核销员
//        $data = Tools::curl($this->url . "admin/verifier/update/update", json_encode(["token" => "$this->token", "id" => 1, "status" => 6]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";

        //Route::any('admin/verifier/delete', 'admin/verifier/toDelVerifier');                                                    // 删除核销员
//        $data = Tools::curl($this->url . "admin/verifier/delete", json_encode(["token" => "$this->token", "id" => 1]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
    }
}
